home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_Text / rotateprocs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  3.1 KB  |  92 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    rotateprocs.h
  35.  *
  36.  *    The header file for the procedures for rotated graphic operations.
  37.  *
  38.  *    Version:    2.0
  39.  *    Author:    Ken Fromm
  40.  *    History:
  41.  *            03-07-91        Added this comment.
  42.  */
  43.  
  44. /*
  45. *    If alternate key is down, constrain every 15 degrees.
  46. *    (2 pi div 24 = pi div 12) see ConstrainPointToAngle()
  47. */
  48. #define  ANGLES    12.0
  49.  
  50. #define  ANGLE            (180/M_PI)
  51.  
  52. /*
  53. *    Takes the point passed in, rotates it around the point
  54. *    at the angle given and returns the new point.
  55. *    The new point replaces the old one and its address
  56. *    is returned as the return value.
  57. */
  58. extern NXPoint *RotatePoint(NXPoint *aPoint, NXPoint *cPoint, float angle);
  59.  
  60. /*
  61. *    Checks whether the point passed in lies in the rectangle
  62. *    rotated about its lower left vertice at the angle provided.
  63. *    Returns either YES or NO. Assumes an unflipped 
  64. *    coordinate system.
  65. */
  66. extern BOOL MouseInRotatedRect(NXPoint *aPoint, NXRect *aRect, float angle);
  67.  
  68. /*
  69. *    This procedure takes the unrotated rectangle, bRect,
  70. *    rotates it around the point, cPoint, at the angle, angle,
  71. *    and places the new bounding box that encloses the
  72. *    rotated rectangle in the rectangle aRect. The address
  73. *    of the new rectangle is returned as the return value.
  74. */
  75. NXRect *RotateRectBounds(NXRect *aRect, const NXRect *bRect,
  76.         NXPoint *cPoint, float angle);
  77.  
  78. /*
  79. *    This procedure takes two rectangles and an angle.
  80. *    It checks if the second rectangle rotated about its center
  81. *    at the given angle intersects the first rectangle. The
  82. *    first rectangle is unrotated. 
  83. */
  84. extern BOOL IntersectsRotatedRect(NXRect *aRect, NXRect *bRect, float angle);
  85.  
  86. /*
  87. *    This procedure takes two points and constrains the first
  88. *    point to the nearest interval for the angle passed in.
  89. */
  90. extern void ConstrainPointToAngle(NXPoint *aPoint, NXPoint *bPoint, float angle);
  91.  
  92.